package com.sctvcloud.dongqu.ui.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.ruihang.generalibrary.ui.adapter.BaseHolderAbsAdapter;
import com.sctvcloud.dongqu.R;
import com.sctvcloud.dongqu.beans.NewsItem;
import com.sctvcloud.dongqu.ui.adapter.holder.RelateHolder;

import java.util.List;

/**
 * Created by liuyu on 2017/8/17.
 */

public class RelateAdapter extends BaseHolderAbsAdapter<NewsItem, RelateHolder> {
    public RelateAdapter(Context context, List<NewsItem> list) {
        super(context, list);
    }

    @Override
    public int getItemCount() {
        if (data != null) {
            int size = data.size();
//            if (size > 5) {
//                return 5;
//            }
            return size;
        }
        return 0;
    }

    @Override
    public RelateHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View v = LayoutInflater.from(context).inflate(R.layout.item_relate, parent, false);
        RelateHolder rh=new RelateHolder(context, v);
        rh.setInternalClick(this);
        return rh;
    }
}
